﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ec_System.Models.Web;
using Ilongshi.Oversea.DataAccess;

namespace Ec_System.Service.Web
{
    public class PromotionScheduleService
    {
        /// <summary>
        /// 获取前9个的促销商品
        /// </summary>
        /// <returns></returns>
        public List<PromotionScheduleData> GetTop9PromotionSchedule()
        {
            var cmd = DataCommandManager.GetDataCommand("GetTop9PromotionSchedule");

            return cmd.ExecuteEntityList<PromotionScheduleData>();
        }

        /// <summary>
        /// 根据商品ID到促销表去查询
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        public PromotionScheduleData GetPromotionScheduleByProductID(int productID)
        {
            var cmd = DataCommandManager.GetDataCommand("GetPromotionScheduleByProductID");
            cmd.SetParameterValue("@productID", productID);

            return cmd.ExecuteEntity<PromotionScheduleData>();
        }
    }
}
